package com.hinnotek.amoeba.repo

import com.hinnotek.amoeba.api.ApiService
import com.hinnotek.amoeba.base.BaseBean
import com.hinnotek.amoeba.bean.old.AmibaInstallByIdBean
import com.hinnotek.amoeba.bean.old.AmibaInstallPageByUserIdBean
import com.lee.common.base.BaseRepository
import com.lee.common.network.net.StateLiveData
import okhttp3.RequestBody
import javax.inject.Inject

class AmibaInstallRepo @Inject constructor(private val service: ApiService) : BaseRepository() {

    /**
     * app端获取合同列表分页接口
     */
    suspend fun getAmibaInstallPageByUserId(
        applyUserId: Int,
        pageNo: Int,
        pageSize: Int,
        stateLiveData: StateLiveData<MutableList<AmibaInstallPageByUserIdBean>>
    ) {
        executeResp({ service.getAmibaInstallPageByUserId(applyUserId,pageNo,pageSize) }, stateLiveData)
    }

    suspend fun updateAmibaInstallCompleteState(amibaInstallId: Int, stateLiveData: StateLiveData<BaseBean>) {
        executeResp({ service.updateAmibaInstallCompleteState(amibaInstallId) }, stateLiveData)
    }

    suspend fun addAmibaInstallContinued(amibaInstallId: Int, continuedMoney: String, stateLiveData: StateLiveData<BaseBean>) {
        executeResp({ service.addAmibaInstallContinued(amibaInstallId,continuedMoney) }, stateLiveData)
    }

    suspend fun getAmibaInstallById(amibaInstallId: Int, stateLiveData: StateLiveData<AmibaInstallByIdBean>) {
        executeResp({ service.getAmibaInstallById(amibaInstallId) }, stateLiveData)
    }

    suspend fun addAmibaInstall(requestBody: RequestBody, stateLiveData: StateLiveData<BaseBean>) {
        executeResp({ service.addAmibaInstall(requestBody) }, stateLiveData)
    }
}